<?php 
/**
* Database Storage plugin
*
* @version		$Id: Database.php 161 2009-07-04 06:28:34Z dr_drsh $
* @package		Joomla
* @subpackage	JForms
* @copyright	Copyright (C) 2008 Mostafa Muhammad. All rights reserved.
* @license		GNU/GPL
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');

class JFormSPluginCustomphp{

	function searchRecords($form, $fields, $start, $rpp, $keyword ){
		//Do Nothing
	}

	function onFormCreate( &$form, $elementPlugins ){
		//Do Nothing
	}

	function onFormSave( &$form, $elementPlugins ){
		//Do Nothing
	}

	function onFormDelete( $form, $additionalParameters ){
		//Do Nothing
	}

	function deleteRecords( $form , $idsArray ){
		//Do Nothing
		return false;
	}

	function getRecords( $form, $ids ){
		//Do Nothing
		return null;
	}

	function saveRecord( $form, $data, $jForm = null ){
    global $JFormGlobals;
		$pManager = $JFormGlobals['JFormsPlugin'];

		$pluginSettings  = $form->storagePluginParameters['Customphp'];

		$fields = indexByHash( $form->fields );

		$file = $pluginSettings['file'];
    if(!empty($file)){
      include($file);
    }
	}
}